<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <% include ../common/public.ejs %>
    <link rel="stylesheet" href="<%= global.config.path.publicPath %>/custom/css/prizeRecord.css">
    <title>中奖记录</title>
    <style>
        .changeRecord{
            width: 80%;
            height: 40px;
            line-height: 40px;
            border: solid 1px;
            margin: 15px auto 0 auto;
            border-radius: 5px;
            text-align: center;
            color: white;
        }
    </style>
</head>
<body>
<div id="container" v-cloak >
    <div class="prizeInfo"  v-for="record in records" v-if="record.prize" >
        <div class="topPannel" >
            <div class="leftCircle"></div>
            <div class="rightCircle"></div>
            <div class="weui-flex" style="width: 100%">
                <div class="weui-flex__item leftBar">
                    <div class="brand" style="background-image:url(<%= global.config.path.publicPath %>/images/brand.png);"></div>
                    <div class="changeRecord" v-if="record.awardFlag =='1'">已领奖</div>
                    <div class="changeRecord getPrize" v-else-if="record.awardFlag =='0'"  v-on:click="changeRecord(record._id)">未领奖</div>
                </div>
                <div class="weui-flex__item rightBar">
                    <p class="rightBarTitle">
                        {{record.officialAccount.name}}
                    </p>
                    <p>活动：{{record.eventId.eventName}}</p>
                    <div v-if="record.prize.prizeType === 'point'">
                        <p>
                            奖品：{{record.prize.rule}}
                        </p>
                        <p>
                            积分：{{record.prize.point}}
                        </p>
                    </div>
                    <div v-else-if="record.prize.prizeType === 'coupon'">
                        <p>
                            奖品：{{record.prize.rule}}
                        </p>
                        <p>
                            礼券名称:{{record.prize.giftName}}
                        </p>
                        <p>
                            礼券号:{{record.giftCode}}
                        </p>
                    </div>
                    <div v-else-if="record.prize.prizeType === 'prize'">
                        <p>
                            奖品：{{record.prize.rule}}
                        </p>
                        <p>
                            实物名称：{{record.prize.priceName}}
                        </p>
                        <p>
                            到期时间:{{ formatterDate(record.eventId.receiveDate)}}
                        </p>
                    </div>
                </div>
            </div>
        </div>
        <div class="botPannel"  >
            <p v-if="record.prize.prizeType === 'point'">
                中奖时间：{{formatterDate(record.updateTime)}}
            </p>
            <p v-if="record.prize.prizeType === 'coupon'">
                中奖时间：{{ formatterDate(record.updateTime)}} &nbsp; 在“我的礼券”中使用
            </p>
            <p v-if="record.prize.prizeType === 'prize'">
                中奖时间：{{formatterDate(record.updateTime)}}
            </p>
        </div>
    </div>
    <div  v-if="records.length === 0"  style="margin-top:25%;text-align: center">
        sorry,暂无中奖记录
        <br>
        <img src="<%= global.config.path.publicPath %>/custom/images/icon/nomore.png" alt="">
    </div>
</div>

<% include ../common/footer.ejs %>

</body>
<script src="<%=global.config.cdn.path %>/vue/2.2.2/vue.min.js"></script>
</html>
